class Solution:
    def __init__(self):
        self.dict1 = {
            "2": ["a", "b", "c"],
            "3": ["d", "e", "f"],
            "4": ["g", "h", "i"],
            "5": ["j", "k", "l"],
            "6": ["m", "n", "o"],
            "7": ["p", "q", "r", "s"],
            "8": ["t", "u", "v"],
            "9": ["w", "x", "y", "z"]
        }

    def letterCombinations(self, digits: str) -> list[str]:

        list1 = list(digits)
        list2 = []
        return self.weo(0, list1, list2)

    def weo(self, index, list1, list2):
        if index == len(list1):
            return list2
        ll = list1[index]
        index += 1
        list3 = []
        if len(list2) == 0:
            list3 = self.dict1[ll]
        else:
            for i in range(len(list2)):
                for j in self.dict1[ll]:
                    list3.append(list2[i] + j)
        return self.weo(index, list1, list3)


lll = Solution()
print(lll.letterCombinations("2342"))
